<el-dialog :close-on-click-modal="false"  :close-on-press-escape="false"  class="dialogStyleBase" :title="mixinEdit_editTitle" width="1180px" :visible.sync="mixinEdit_editVisible"
    :before-close="function(){mixinEdit_editBoxClose('editForm')}" append-to-body>
    <div class="dialogStyleBaseBox"  v-loading="mixinEdit_loading">
        <el-form ref="editForm" :model="form" label-width="100px"
            :disabled="form.activityStatus == 3 && this.mixinEdit_editType == 'update'" label-position="left">

            <LayoutCell>
                <LayoutCellItem title="基本信息">
                    <!-- 基本信息 -->
                    <el-form-item label="活动名称" prop="activityName" :rules="{ required: true, message: '活动名称 不能为空'}">
                        <el-input v-model="form.activityName" maxlength="15" show-word-limit>
                        </el-input>
                    </el-form-item>
                    <el-form-item label="活动时间">
                        <div class="box">
                            <span>
                                <el-form-item :rules="{ required: true, message: '请选择开始时间'}" prop="startTimeStr">
                                    <el-date-picker v-model="form.startTimeStr" type="datetime" :disabled="isDisabled"
                                        value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期">
                                    </el-date-picker>
                                </el-form-item>
                            </span>
                            <span class="cut">至</span>
                            <span>
                                <el-form-item :rules="{ required: true, message: '请选择结束时间'}" prop="endTimeStr">
                                    <el-date-picker v-model="form.endTimeStr" type="datetime" :disabled="isDisabled"
                                        value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期">
                                    </el-date-picker>
                                </el-form-item>
                            </span>
                        </div>
                    </el-form-item>
                </LayoutCellItem>

                <LayoutCellItem title="活动规则">
                    <!-- 活动规则 -->
                    <el-form-item label="条件类型" prop="freightType" :rules="{ required: true, message: '活动规则 不能为空'}">
                        <el-radio-group v-model="form.freightType" :disabled="isDisabled">
                            <el-radio :label="1">满x元 </el-radio>
                            <el-radio :label="2">满x件</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="活动方式">
                        <div class="activitylevel" v-for="(item, index) in form.freightItemLst">
                            <el-form-item label="活动条件" prop="conditionValue"
                                :rules="[{trigger: ['blur', 'change'] ,validator: $vFN.Tools.validatePrice}]">

                                <el-input-number v-model="item.conditionValue" controls-position="right"
                                    @change="handleChange" :disabled="isDisabled" :min="minNumber(index)">
                                </el-input-number>
                                <span v-if="form.freightType == 1">元</span>
                                <span v-if="form.freightType == 2">件</span>
                                <el-button style="float: right;" @click="delFreightItem(item, index)"
                                    v-if="form.freightItemLst.length > 1">删除层级</el-button>
                            </el-form-item>
                            <el-form-item label="优惠方式" prop="actionType">
                                <el-radio-group v-model="item.actionType" :disabled="isDisabled">
                                    <el-radio :label="1">包邮 </el-radio>
                                    <el-radio :label="2">减邮费</el-radio>
                                </el-radio-group>
                            </el-form-item>
                            <el-form-item label="减免" prop="discountValue" v-if="item.actionType == 2">
                                <el-input v-model="item.discountValue"></el-input>
                            </el-form-item>
                            <el-form-item label="选择地区" :prop="`freightItemLst[${index}].areaName`"
                                :rules="{ required: true, message: '配送地区不能为空'}">
                                <el-button @click="selectDeliverArea(item, index)" :disabled="isDisabled">
                                    编辑</el-button>
                                <div>
                                    {{ item.areaName }}
                                </div>
                            </el-form-item>
                        </div>

                        <el-button @click="addFreightItem()" :disabled="isDisabled">添加活动层级</el-button>

                    </el-form-item>
                </LayoutCellItem>

                <LayoutCellItem title="活动范围">
                    <!-- 活动范围 -->
                    <el-form-item label="适用商品">
                        <!-- // 应用类型 1全部商品 2商品分组 3商品分类 4指定商品 -->
                        <el-radio-group v-model="form.applyType" :disabled="isDisabled">
                            <el-radio :label="1">全部商品</el-radio>
                            <el-radio :label="4">指定商品</el-radio>
                            <el-radio :label="2">指定分组</el-radio>
                            <el-radio :label="3">指定分类</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="指定商品" v-if="form.applyType==4" prop="freightProductLst"
                        :rules="{ required: true, message: '商品 不能为空'}">
                        <SelectDataGoods v-model="form.freightProductLst" :appWindow="appWindow"
                            :apiConfig="$vFN.Tools.getAppGlobalData('componentsApiConfig.SelectDataGoods',appWindow)">
                        </SelectDataGoods>
                    </el-form-item>
                    <el-form-item label="指定分组" v-if="form.applyType==2" prop="freightProductGroupsLst"
                        :rules="{ required: true, message: '分组 不能为空'}">
                        <SelectDataGoodsGroup style="width:420px" v-model="form.freightProductGroupsLst"
                            :appWindow="appWindow"
                            :apiConfig="$vFN.Tools.getAppGlobalData('componentsApiConfig.SelectDataGoodsGroup',appWindow)">
                        </SelectDataGoodsGroup>
                    </el-form-item>
                    <el-form-item label="指定分类" v-if="form.applyType==3" prop="freightProductCategoryLst"
                        :rules="{ required: true, message: '分类 不能为空'}">
                        <SelectDataGoodsClassify style="width:420px" v-model="form.freightProductCategoryLst"
                            :appWindow="appWindow"
                            :apiConfig="$vFN.Tools.getAppGlobalData('componentsApiConfig.SelectDataGoodsClassify',appWindow)">
                        </SelectDataGoodsClassify>

                    </el-form-item>
                </LayoutCellItem>

                <LayoutCellItem title="活动限制">
                    <el-form-item label="下单可用抵扣" prop="deductOverlayLst">
                        <el-checkbox-group v-model="form.deductOverlayLst">
                            <el-checkbox :disabled="isDisabled" v-for="item in deducteList" :label="item.id"
                                :checked="item.isChecked">{{
                                item.name }}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                </LayoutCellItem>

            </LayoutCell>

        </el-form>
    </div>
    <div slot="footer">
        <el-row>
            <el-col :span="24">
                <el-button @click="mixinEdit_editBoxClose('editForm')"
                     :disabled="mixinEdit_loading || (mixinEdit_editType != 'copy' && form.activityStatus == 3)">取 消
                </el-button>
                <el-button type="primary" @click="mixinEdit_editFormSubmit({model:'form',ref:'editForm'})"
                     :disabled="mixinEdit_loading || (mixinEdit_editType != 'copy' && form.activityStatus == 3)">确
                    定</el-button>
            </el-col>
        </el-row>
    </div>
</el-dialog>